package ch09.d2;


import java.util.Objects;

public class Student {
    String name;
    int score;
    String tel;
    String address;

    public Student(String name, int score, String tel, String address) {
        this.name = name;
        this.score = score;
        this.tel = tel;
        this.address = address;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", score=" + score +
                ", tel='" + tel + '\'' +
                ", address='" + address + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        System.out.println("equals");
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return score == student.score && Objects.equals(name, student.name) && Objects.equals(tel, student.tel) && Objects.equals(address, student.address);
    }

    @Override
    public int hashCode() {
        System.out.println("hashCode");
        return Objects.hash(name, score, tel, address);
    }


}
